<!--
 * @Descripttion: 
 * @version: 
 * @Author: siebe
 * @Date: 2022-02-18 09:58:54
 * @LastEditors: siebe
 * @LastEditTime: 2022-02-21 21:09:13
-->
{include file="public/header" /}
    <form class="layui-form">
        <div class="layui-form-item">
            <input type="hidden" name="__token__" value="{:token()}" />
            <input type="hidden" class="layui-input" name="id" value="{$menu['id']}">
            <label class="layui-form-label">导航名</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" name="name" placeholder="请输入导航名" value="{$menu['name']}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">图标</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" name="icon" placeholder="请输入layui小图标" value="{$menu['icon']}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">排序</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" name="sort" placeholder="请输入排序值,值越大越靠前" value="{$menu['sort']}">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-block">
                <input type="radio" name="status" value="1" title="开启" {if ($menu['status']==1) } checked {/if}>
                <input type="radio" name="status" value="0" title="禁用" {if ($menu['status']==0) } checked {/if}>
            </div>
        </div>
    </form>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="button" class="layui-btn" onclick="save()">保存</button>
        </div>
    </div>
    <script type="text/javascript">
        layui.use(['form'], function () {
            form = layui.form;
            $ = layui.jquery
        });
        function save() {
            $.post("{$config.path}navigation/edit", $('form').serialize(), function (res) {
                if (res.error_code == 0) {
                    layer.msg(res.msg, { 'icon': 1 });
                    setTimeout(function () {
                        parent.window.location.reload();
                    }, 1000);
                } else {
                    layer.msg(res.msg, { 'icon': 2 });
                }
            }, 'json').error(function (res) {
                layer.msg(res.responseJSON.msg, { 'icon': 2 });
            });
        }
    </script>
</body>

</html>